home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / netprog.zip / NETPROG.TAR / tftp / rtt.h < prev    next >
C/C++ Source or Header  |  1989-12-17  |  2KB  |  58 lines

  1. /*
  2.  * Definitions for RTT timing.
  3.  */
  4.  
  5. #include    "systype.h"
  6. #include    <stdio.h>
  7.  
  8. #ifdef BSD
  9. #include    <sys/time.h>
  10. #include    <sys/resource.h>
  11. #endif
  12.  
  13. #ifdef SYS5
  14. #include    <sys/times.h>    /* requires <sys/types.h> */
  15. #include    <sys/param.h>    /* need the definition of HZ */
  16. #define        TICKS    HZ    /* see times(2); usually 60 or 100 */
  17. #endif
  18.  
  19. /*
  20.  * Structure to contain everything needed for RTT timing.
  21.  * One of these required per socket being timed.
  22.  * The caller allocates this structure, then passes its address to
  23.  * all the rtt_XXX() functions.
  24.  */
  25.  
  26. struct rtt_struct {
  27.   float    rtt_rtt;    /* most recent round-trip time (RTT), seconds */
  28.   float    rtt_srtt;    /* smoothed round-trip time (SRTT), seconds */
  29.   float    rtt_rttdev;    /* smoothed mean deviation, seconds */
  30.   short    rtt_nrexmt;    /* #times retransmitted: 0, 1, 2, ... */
  31.   short    rtt_currto;    /* current retransmit timeout (RTO), seconds */
  32.   short    rtt_nxtrto;    /* retransmit timeout for next packet, if nonzero */
  33.  
  34. #ifdef BSD
  35.   struct timeval    time_start;    /* for elapsed time */
  36.   struct timeval    time_stop;    /* for elapsed time */
  37. #endif
  38.  
  39. #ifdef SYS5
  40.   long            time_start;    /* for elapsed time */
  41.   long            time_stop;    /* for elapsed time */
  42.   struct tms        tms_start;    /* arg to times(2), but not used */
  43.   struct tms        tms_stop;    /* arg to times(2), but not used */
  44. #endif
  45.  
  46. };
  47.  
  48. #define    RTT_RXTMIN      2    /* min retransmit timeout value, seconds */
  49. #define    RTT_RXTMAX    120    /* max retransmit timeout value, seconds */
  50. #define    RTT_MAXNREXMT     4    /* max #times to retransmit: must also
  51.                    change exp_backoff[] if this changes */
  52.  
  53. #ifdef    SYS5
  54. long    times();        /* the system call */
  55. #endif
  56.  
  57. extern int    rtt_d_flag;    /* can be set nonzero by caller for addl info */
  58.